Ext.namespace("GridBuildingInfo");

GridBuildingInfo.Detail = function(plist){
	
	this.parentList = plist;
	this.userSelector = null;
	this.selectUserId = null;
	this.users = [];
	
	//营销单元
	this.txtUnitId = new Ext.form.Hidden({
		name:'unitId'
	});
	this.txtBuildingId = new Ext.form.Hidden({
		name:'buildingId'
	});
	//楼宇名称
	this.txtBuildingName = new Ext.form.TextField({
		fieldLabel : '楼宇名称<font color="red">*</font>',
		name :'buildingName',
		width : 200,
		maxLength : 25,
		allowBlank : false,
        blankText : '请输入楼宇名称!'
	});
	//楼宇简介
	this.txtBuildingDesc = new Ext.form.TextArea({
		fieldLabel : '楼宇简介<font color="red">*</font>',
		name :'buildingDesc',
		width : 400,
		maxLength : 1000
	});
	//地址ID
	this.txtAddressId = new Ext.form.Hidden({
		name : 'addressId'
	});
	//行政区县
	this.txtDistrict = new Ext.form.TextField({
		width : 120,
        fieldLabel : '行政区县<font color="red">*</font>',
		name : 'addressInfo.district',
        value: '浦东新区',
		maxLength : 10
	});
	//街道路段
	this.txtAddressInfoNeighbourhood = new Ext.form.TextField({
		fieldLabel : '街道路段',
		name : 'addressInfo.neighbourhood',
		width : 150,
		maxLength : 10
	});
	//地址-路
	this.txtAddressInfoStreet = new Ext.form.TextField({
		fieldLabel : '地址 路<font color="red">*</font>',
		name :'addressInfo.street',
		width : 150,
		maxLength : 10
	});
	//弄
	this.txtAddressInfoAlley = new Ext.form.NumberField({
		fieldLabel: '弄<font color="red">*</font>',
		name :'addressInfo.alley',
		width: 60,
		maxLength : 10
	});
	//号
	this.txtAddressInfoDoorNum = new Ext.form.NumberField({
		fieldLabel: '号<font color="red">*</font>',
		name :'addressInfo.doorNum',
		width: 60,
		maxLength : 10
	});
	//楼宇类别
	this.cmbBuildingType = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '楼宇类型<font color="red">*</font>',
//        hiddenName :'buildingType',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_TYPE
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        triggerAction: 'all',
        editable: false,
        emptyText:'',
        selectOnFocus: true,
        forceSelection:true
    });
    
    //楼宇档次
    this.cmbBuildingGrade = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '楼宇档次<font color="red">*</font>',
//        hiddenName : 'buildingGrade',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_GRADE
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        triggerAction: 'all',
        emptyText:'',
        selectOnFocus: true,
        forceSelection:true
    });
	//楼宇整体外观
    this.cmbBuildingAppearance = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '楼宇整体外观',
//        hiddenName : 'buildingAppearance',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_APPEARANCE
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        triggerAction: 'all',
        emptyText:'',
        selectOnFocus: true,
        forceSelection:true
    });
    //附近商圈
    this.cmbBuildingBusinessArea = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '所属商圈<font color="red">*</font>',
//        hiddenName : 'businessArea',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_BUSINESSAREA
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        triggerAction: 'all',
        emptyText:'',
        selectOnFocus: true,
        forceSelection:true
    });
    //楼宇开发商名称
    this.txtDevelopCompany = new Ext.form.TextField({
		fieldLabel : '开发商/业主<font color="red">*</font>',
		name : 'developCompany',
		width : 150,
		maxLength : 25
	});
	//楼宇注册资金
	this.txtRegisteredCapital = new Ext.form.NumberField({
		fieldLabel: '楼宇注册资金',
		name : 'registeredCapital',
		width: 80,
		maxLength : 10
	});
	
	//开发商联系人
	this.txtDcContactInfoContactId = new Ext.form.Hidden({
		name :'dcContactInfo.contactId'
	});
    this.txtDevelopContactName = new Ext.form.TextField({
		fieldLabel : '开发商联系人',
		name : 'dcContactInfo.userName',
		width : 120,
		maxLength : 25
	});
	
	//开发商联系电话
    this.txtDevelopContactPhone = new Ext.form.NumberField({
		fieldLabel : '开发商联系电话',
		name : 'dcContactInfo.phoneNumOffice',
		width : 120,
		maxLength : 15
	});
	//楼宇建设进展
	this.cmbBuildingConstructionsStatus = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '楼宇建设进展',
//        hiddenName : 'constructionStatus',
        store: OMS.GRIDBUILDING_CONSTRUCTIONS_STATUS,
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    
    //竣工日期
    this.dfBuildingFinishDate = new Ext.form.DateField({
    	fieldLabel :'竣工日期:',
    	name : 'constructionFinishDate',
    	labelSeparator: '',
		width: 120,
		format: 'Y-m-d'
	});
	 //生效日期
    this.dfEnableDate = new Ext.form.DateField({
    	fieldLabel :'生效日期:',
    	name : 'enableDate',
    	labelSeparator: '',
		width: 120,
		format: 'Y-m-d'
	});
	 //失效日期
    this.dfDisableDate = new Ext.form.DateField({
    	fieldLabel :'失效日期:',
    	name : 'disableDate',
    	labelSeparator: '',
		width: 120,
		format: 'Y-m-d'
	});
	this.cmbUnitStatus = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '状态',
        store: OMS.GRIDUNIT_STATUS,
        valueField : 'value',
		displayField : 'text',
        typeAhead:true,
        editable: false,
        mode: 'local',
        triggerAction: 'all',
//        emptyText:'',
        selectOnFocus: true,
        forceSelection:true
    });
	this.cmbSecrecyLevel = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '保密选项',
//        hiddenName : 'secrecyLevel',
        store: OMS.SECRECY_LEVEL,
        valueField : 'value',
		displayField : 'text',
        typeAhead:true,
        mode: 'local',
        triggerAction: 'all',
//        emptyText:'',
		editable: false,
        selectOnFocus: true,
        forceSelection:true
    });
	//楼宇图片
	this.txtImageFile = new Ext.form.TextField({
		fieldLabel: '楼宇图片',
		id : 'fileUpload',
		name : 'buildingPics',
		inputType: 'file'
	});
	//最近的营业厅名称
    this.nearlyHallName = new Ext.form.TextField({
		fieldLabel : '最近营业厅',
		name : 'nearlyHallName',
		width : 120,
		maxLength : 25
	});	
	//楼栋数
    this.buildingNum = new Ext.form.TextField({
		fieldLabel : '楼栋数',
		name : 'buildingNum',
		width : 120,
		maxLength : 25
	});	 
	//门洞数
    this.doorNum = new Ext.form.TextField({
		fieldLabel : '门洞数',
		name : 'doorNum',
		width : 120,
		maxLength : 25
	});	    
	//承包方
    this.builderName = new Ext.form.TextField({
		fieldLabel : '承包方',
		name : 'builderName',
		width : 120,
		maxLength : 25
	});    
    
	//基本信息
	this.form = new Ext.form.FormPanel({
		bodyStyle : 'padding: 5px 5px 0',
		frame :true,
		fileUpload: true, 
		autoScroll : true,
		//autoHeight : true,
		height: 390,
		width : 700,
		labelAlign: 'right',
		labelWidth : 120,
		layout : 'table',
		layoutConfig : {columns:2},
		items:[
			{colspan:2,layout:'form',items:[this.txtBuildingName,this.txtBuildingId,this.txtUnitId]},
			{colspan:2,layout:'form',items:[this.txtBuildingDesc]},
			{layout:'form', items:[this.txtAddressId,this.txtDistrict]},
            {layout:'form', items:[this.txtAddressInfoNeighbourhood]},
            {colspan:2,layout:'form',items:[
            			{layout:'form',items:this.txtAddressInfoStreet},
            			{layout:'form',items:this.txtAddressInfoAlley},
            			{layout:'form',items:this.txtAddressInfoDoorNum}
            			]},
            {layout:'form', items:[this.cmbBuildingType]},
            {layout:'form', items:[this.cmbBuildingGrade]},
            {layout:'form', items:[this.cmbBuildingAppearance]},
            {layout:'form', items:[this.cmbBuildingBusinessArea]},
            {layout:'form', items:[this.txtDevelopCompany]},
            {layout:'form', items:[this.txtRegisteredCapital]},            
            {layout:'form', items:[this.txtDevelopContactName]},
            {layout:'form', items:[this.txtDevelopContactPhone]},
            {layout:'form', items:[this.cmbBuildingConstructionsStatus]},
            {layout:'form', items:[this.dfBuildingFinishDate]},
            {layout:'form', items:[this.dfDisableDate]},
            {layout:'form', items:[this.dfEnableDate]},
            {layout:'form', items:[this.cmbSecrecyLevel]},
            {layout:'form', items:[this.cmbUnitStatus]},
            {layout:'form', items:[this.nearlyHallName]},
            {layout:'form', items:[this.buildingNum]},
            {layout:'form', items:[this.doorNum]},
            {layout:'form', items:[this.builderName]},
            {colspan:2,layout:'form', items:[this.txtImageFile]}
		]
	});
	
	//GIS信息
	//所属网格
	this.cmbGridId = new Ext.form.ComboBox({
        width: 133,
        listWidth:150,
        fieldLabel: '所属网格',
        name : 'gridId',
        store : new Ext.data.JsonStore({
		   url:"../gridareas/listGrid.form",
		   autoLoad : true,
		   root:"grids",
		   fields:["gridId","gridName"]
		}),
		valueField : 'gridId',
		editable: false,
		displayField :'gridName',
        mode: 'local',
//        typeAhead:true,
		emptyText:'请选择所属网格',
        triggerAction: 'all',
        selectOnFocus: true
		//disabled:true
    });
	
	//所属区域
	this.cmbRegion = new Ext.form.ComboBox({
		width :133,
		listWidth:150,
		allowBlank : true,
		blankText:'请选择所属区域',
		fieldLabel: '所属区域',
		store : new Ext.data.JsonStore({
		   url:'../gridareas/listAllRegions.form',
		   autoLoad : true,
		   root:"regions",
		   fields:["areaId","name"]
		}),
		valueField : 'areaId',
		displayField :'name',
		editable: false,
        mode: 'local',
		triggerAction :'all',
		emptyText :'请选择所在区域',
		selectOnFocus :true	
		//disabled:true
	});
	
    //楼宇经度 
    this.txtAddressInfoLongitude = new Ext.form.TextField({
    	fieldLabel : '楼宇经度',
    	name : 'addressInfo.longitude',
		width : 150
    });
    //楼宇纬度
    this.txtAddressInfoLatitude = new Ext.form.TextField({
    	fieldLabel : '楼宇纬度',
    	name : 'addressInfo.latitude',
		width : 150
    });
    //GIS_ID
    this.txtGisId = new Ext.form.Hidden({
    	name: 'gis.id'
    });
    //图标ID
    this.txtGisIconId = new Ext.form.Hidden({
    	name: 'gis.iconId'
    });
    
    this.txtEcoordx = new Ext.form.Hidden({
    	name: 'gis.ecoordx'
    });
    
    this.txtEcoordy = new Ext.form.Hidden({
    	name: 'gis.ecoordy'
    });

    //绘制楼宇
    this.btnDrawGis = new Ext.Button({
        text: '绘制楼宇',
        tooltip: {text: '绘制楼宇'},
        handler: this.viewGis,
        scope: this
    });
    
    //GIS信息--FormPanel
    this.gisform = new Ext.form.FormPanel({
		bodyStyle : 'padding: 5px 5px 0',
		frame :true,
		//autoHeight : true,
		height:420,
		id : 'gisForm',
		width : 700,
		labelAlign: 'right',
		labelWidth : 120,
		//disabled : true,
		layout : 'table',
		layoutConfig : {columns:2},
		items:[
			{layout:'form',items:[this.cmbRegion]},
			{layout:'form',items:[this.cmbGridId]},
			{layout:'form', items:[this.txtAddressInfoLongitude]},
            {layout:'form', items:[this.txtAddressInfoLatitude]},
            {layout:'form', items:[this.txtGisIconId]},
            {colspan:2,layout:'form', items:[this.btnDrawGis]},
            {layout:'form', items:[this.txtEcoordx]},
            {layout:'form', items:[this.txtEcoordy]},
            {layout:'form', items:[this.txtGisId]}
		]
	});
    
    ////租赁信息
	//楼宇开始招租日期
	this.dfRentStartDate = new Ext.form.DateField({
    	fieldLabel :'楼宇开始招租日期:',
    	name : 'rentStartDate',
    	labelSeparator: '',
		format: 'Y-m-d'
	});
	
	//楼宇面积
	this.txtTotalArea = new Ext.form.NumberField({
    	fieldLabel : '楼宇面积<font color="red">*</font>',
    	name : 'totalArea',
		width : 120,
		maxLength : 10
    });
	//楼宇层数
    this.txtTotalFloors = new Ext.form.NumberField({
    	fieldLabel : '楼宇层数<font color="red">*</font>',
    	name : 'totalFloors',
		width : 120,
		maxLength : 5
    });
	//楼宇总商户数
    this.TotalMerchantNum = new Ext.form.NumberField({
    	fieldLabel : '楼宇总商户数',
    	name : 'totalMerchantNum',
		width : 120,
		maxLength : 5
    });
	//已入驻商户数
    this.txtCheckinMerchantNum = new Ext.form.NumberField({
    	fieldLabel : '已入驻商户数',
    	name : 'checkinMerchantNum',
		width : 120,
		maxLength : 5
    });
	//楼宇入住率
     this.txtOccupancyRate = new Ext.form.NumberField({
    	fieldLabel : '楼宇入住率',
    	name : 'occupancyRate',
		width : 120,
		maxLength : 5
    });
	//楼宇租金 
     this.txtRentCharge = new Ext.form.NumberField({
    	fieldLabel : '楼宇租金',
    	name : 'rentCharge',
		width : 120
    });
	//楼宇车位 
    this.txtGarageNum = new Ext.form.NumberField({
    	fieldLabel : '楼宇车位',
    	name : 'garageNum',
		width : 120,
		maxLength : 5
    });
	//楼宇中商户行业特征
    //排名第一行业
    this.cmbFirstIndustry = new Ext.form.ComboBox({
        width: 80,
        fieldLabel: '排名第一行业',
        name : 'firstIndustry',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data:OMS.GRIDBUILDING_INDUSTRY
        }),
        valueField: 'value',
        displayField: 'name',
        editable: false,
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    this.txtFirstIndustryPer = new Ext.form.NumberField({
    	fieldLabel : '占比',
    	name : 'firstIndustryPer',
		width : 80,
		maxLength : 5
    });
    //排名第二行业
    this.cmbSecondIndustry = new Ext.form.ComboBox({
        width: 80,
        fieldLabel: '排名第一行业',
        name : 'secondIndustry',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_INDUSTRY
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    this.txtSecondIndustryPer = new Ext.form.NumberField({
    	fieldLabel : '占比',
    	name : 'secondIndustryPer',
		width : 80
    });
    //排名第三行业
    this.cmbThirdIndustry = new Ext.form.ComboBox({
        width: 80,
        fieldLabel: '排名第一行业',
        name : 'thirdIndustry',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_INDUSTRY
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    this.txtThirdIndustryPer = new Ext.form.NumberField({
    	fieldLabel : '占比',
    	name : 'thirdIndustryPer',
		width : 80,
		maxLength : 5
    });
    //楼宇招商方向
	this.txtAttractInvestment = new Ext.form.TextField({
    	fieldLabel : '楼宇招商方向',
    	name : 'attractInvestment',
		width : 120,
		maxLength : 50
    });
    
    //租赁信息--FormPanel
    
    this.fsIndustry = new Ext.form.FieldSet({
		title:'楼宇中商户行业特征',
		layout:'table',
		labelAlign: 'right',
		labelWidth : 150,
		layoutConfig:{columns:2},
		items:[
			{colspan:1,width:250,layout:'form',items:[this.cmbFirstIndustry]},
			{colspan:1,layout:'form',items:[this.txtFirstIndustryPer]},
			{colspan:1,width:250,layout:'form',items:[this.cmbSecondIndustry]},
			{colspan:1,layout:'form',items:[this.txtSecondIndustryPer]},
			{colspan:1,width:250,layout:'form',items:[this.cmbThirdIndustry]},
			{colspan:1,layout:'form',items:[this.txtThirdIndustryPer]}
		]
	});
	
     this.rentform = new Ext.form.FormPanel({
		bodyStyle : 'padding: 15px 15px 10',
		frame :true,
		//autoHeight : true,
		height:420,
		align:'center',
		width : 700,
		labelAlign: 'right',
		labelWidth : 140,
		layout : 'table',
		layoutConfig : {columns:2},
		items:[
		{colspan:1,layout:'form', items:[this.dfRentStartDate]},
		{colspan:1,layout:'form', items:[this.txtTotalArea]},
		{colspan:1,layout:'form', items:[this.txtTotalFloors]},
		{colspan:1,layout:'form', items:[this.TotalMerchantNum]},
		{colspan:1,layout:'form', items:[this.txtCheckinMerchantNum]},
		{colspan:1,layout:'form', items:[this.txtRentCharge]},
		{colspan:1,layout:'form', items:[this.txtGarageNum]},
		{colspan:1,layout:'form', items:[this.txtAttractInvestment]},
		{colspan:2,layout:'form', items:[this.fsIndustry]}
		]
	});
	
    
    ////物业信息
    //楼宇物业公司名称 
    this.txtPropertyCompany = new Ext.form .Hidden({
    	name : 'propertyCompany'
    });
    
    this.txtCompanyInfoCustName  = new Ext.form.TextField({
    	fieldLabel : '物业公司名称<font color="red">*</font>',
    	name : 'propertyCompanyInfo.custName',
		width : 150,
		maxLength : 25
    });
    
    //物业公司联系人1
    this.txtPmContactInfoContactId = new Ext.form .Hidden({
    	name : 'pmContactInfo.contactId'
    });
    this.txtPmContactInfoUserName = new Ext.form.TextField({
    	fieldLabel : '姓名',
    	name : 'pmContactInfo.userName',
		width : 120,
		maxLength : 25
    });
    this.txtPmContactInfoPosition = new Ext.form.TextField({
    	fieldLabel : '职位',
    	name : 'pmContactInfo.position',
		width : 120,
		maxLength : 25
    });
    //办公电话
    this.txtPmContactInfoPhoneNumOffice = new Ext.form.NumberField({
    	fieldLabel : '办公电话',
    	name : 'pmContactInfo.phoneNumOffice',
		width : 120,
		maxLength : 15
    });
     //移动电话
   this.txtPmContactInfoMobileNumber = new Ext.form.NumberField({
    	fieldLabel : '移动电话',
    	name : 'pmContactInfo. ',
		width : 120,
		maxLength : 15
    });
    //物业公司物业公司联系人2
    this.txtPbContactInfoContactId = new Ext.form.Hidden({
    	name : 'pbContactInfo.contactId'
    });
    this.txtPbContactInfoUserName = new Ext.form.TextField({
    	fieldLabel : '姓名',
    	name : 'pbContactInfo.userName',
		width : 120,
		maxLength : 25
    });
     this.txtPbContactInfoPosition = new Ext.form.TextField({
    	fieldLabel : '职位',
    	name : 'pbContactInfo.position',
		width : 120,
		maxLength : 25
    });
    //办公电话
    this.txtPbContactInfoPhoneNumOffice = new Ext.form.NumberField({
    	fieldLabel : '办公电话',
    	name : 'pbContactInfo.phoneNumOffice',
		width : 120,
		maxLength : 15
    });
     //移动电话
    this.txtPbContactInfoMobileNumber = new Ext.form.NumberField({
    	fieldLabel : '移动电话',
    	name : 'pbContactInfo.mobileNumber',
		width : 120,
		maxLength : 15
    });
    //物业公司联系人3
     this.txtPpContactInfoContactId = new Ext.form.Hidden({
    	name : 'ppContactInfo.contactId'
    });
    this.txtPpContactInfoUserName = new Ext.form.TextField({
    	fieldLabel : '姓名',
    	name : 'ppContactInfo.userName',
		width : 120,
		maxLength : 25
    });
    this.txtPpContactInfoPosition = new Ext.form.TextField({
    	fieldLabel : '职位',
    	name : 'ppContactInfo.position',
		width : 120,
		maxLength : 25
    });
    
    //办公电话
    this.txtPpContactInfoPhoneNumOffice = new Ext.form.NumberField({
    	fieldLabel : '办公电话',
    	name : 'ppContactInfo.phoneNumOffice',
		width : 120,
		maxLength : 15
    });
     //移动电话
    this.txtPpContactInfoMobileNumber = new Ext.form.NumberField({
    	fieldLabel : '移动电话',
    	name : 'ppContactInfo.mobileNumber',
		width : 120,
		maxLength : 15
    });
    this.formFieldSet1 = new Ext.form.FieldSet({
	        title: '联系人1',
	        layout:'table',
	        autoHeight: true,
	        labelAlign:'right',
	        layoutConfig:{columns:2},
	        items:[
				{colspan:1,layout:'form', items:[this.txtPmContactInfoUserName]},
	        	{colspan:1,layout:'form', items:[this.txtPmContactInfoPosition]},
				{colspan:1,layout:'form', items:[this.txtPmContactInfoPhoneNumOffice]},
				{colspan:1,layout:'form', items:[this.txtPmContactInfoMobileNumber]},
				{colspan:1,layout:'form', items:[this.txtPmContactInfoContactId]}
			]
		});
	this.formFieldSet2 = new Ext.form.FieldSet({
	        title: '联系人2',
	        layout:'table',
	        autoHeight: true,
	        labelAlign:'right',
	        layoutConfig:{columns:2},
	        items:[
				{colspan:1,layout:'form', items:[this.txtPbContactInfoUserName]},
	       		{colspan:1,layout:'form', items:[this.txtPbContactInfoPosition]},
				{colspan:1,layout:'form', items:[this.txtPbContactInfoPhoneNumOffice]},
				{colspan:1,layout:'form', items:[this.txtPbContactInfoMobileNumber]},
				{colspan:1,layout:'form', items:[this.txtPbContactInfoContactId]}
			]
		});
	this.formFieldSet3 = new Ext.form.FieldSet({
	        title: '联系人3',
	        layout:'table',
	        autoHeight: true,
	        labelAlign:'right',
	        layoutConfig:{columns:2},
	        items:[
	        	{colspan:1,layout:'form', items:[this.txtPpContactInfoUserName]},
	        	{colspan:1,layout:'form', items:[this.txtPpContactInfoPosition]},
				{colspan:1,layout:'form', items:[this.txtPpContactInfoPhoneNumOffice]},
				{colspan:1,layout:'form', items:[this.txtPpContactInfoMobileNumber]},
				{colspan:1,layout:'form', items:[this.txtPpContactInfoContactId]}
			]
		});
    //物业信息---FormPanel
    this.contactInfoForm = new Ext.form.FormPanel({
		bodyStyle : 'padding: 5px 5px 0',
		frame :true,
		//autoHeight : true,
		height:420,
		align:'center',
		width : 700,
		labelAlign: 'right',
		labelWidth : 150,
		layout : 'table',
		layoutConfig : {columns:1},
		items:[
			{colspan:1,layout:'form', items:[this.txtPropertyCompany]},
			{colspan:1,layout:'form', items:[this.txtCompanyInfoCustName]},
			this.formFieldSet1,this.formFieldSet2,this.formFieldSet3
		]
	});
    
	////业务信息
    //客户经理
    this.txtUnitManagerUserBranchId = new Ext.form .Hidden({
    	name : 'unitManagerUser.branchId'
    });
    
    this.txtUnitManager = new Ext.form.TextField({
		fieldLabel: '客户经理<font color="red">*</font>',
		readOnly: true,
		name : 'unitManagerUser.userName',
		width: 100,
		listeners: {
		'render': function(cmp) {
				var self = cmp.ownerCt.ownerCt.ownerCt.ownerCt.ownerCt;
				//console.info(self)
				cmp.getEl().on('click', self.showSelector, self); 
			}
		}
	});
    //联系方式
	 this.txtUnitManagerPhone = new Ext.form.NumberField({
    	fieldLabel : '联系方式',
    	name : 'unitManagerUser.userPhone',
		width : 120,
		maxLength : 15
    });
    //楼内主要运营商
    this.txtOperators = new Ext.form.Hidden({
    	name : 'operators'
    });

    this.chkMainOperatorList= new Ext.form.CheckboxGroup({
		width:200,
		fieldLabel: '楼内主要运营商',
		name : 'operatorsInfo.mainOperatorArray',
		items: [
		      {boxLabel: '移动', inputValue: '1'},
		      {boxLabel: '电信', inputValue: '2'},
		      {boxLabel: '联通', inputValue: '3'},
		      {boxLabel: '其他', inputValue: '4'}
		]
	});
    //传输到位情况
	this.cmbTransferInplaceList = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '传输到位情况',
        name : 'operatorsInfo.transferInplace',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_TRANSFERINPLACE_STATUS 
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //G已建
    this.cmbHasG = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: 'G已建',
        name : 'operatorsInfo.hasG',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //TD已建
    this.cmbHasTd = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: 'TD已建',
        name : 'operatorsInfo.hasTd',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        editable: false,
        selectOnFocus: true,
        forceSelection:true
    });
    //WLAN已建
    this.cmbHasWlan = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: 'WLAN已建<font color="red">*</font>',
        name : 'operatorsInfo.hasWlan',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        editable: false,
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //移动宽带接入
    this.cmbHasBroadBand = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '移动宽带接入',
        name : 'operatorsInfo.hasBroadBand',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        editable: false,
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //是否数据节点
    this.cmbIsDataNode = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '是否数据节点',
        name : 'operatorsInfo.isDataNode',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        editable: false,
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //是否推荐过业务
    this.cmbHasRecommend = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '是否推荐过业务',
        name : 'operatorsInfo.hasRecommend',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    
    //客户对运营商的评价  	
	this.cmbCustOpinion = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '客户对运营商的评价',
        name : 'operatorsInfo.custOpinion',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_OPINION
        }),
        valueField: 'value',
        displayField: 'name',
        editable: false,
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    this.txtCustOpinionDesc = new Ext.form.TextArea({
		//fieldLabel : '客户对运营商的评价 ',
		width : 400,
		height : 40,
		name : 'operatorsInfo.custOpinionDesc',
		maxLength : 1000
	});
    
	//已开展哪些业务
	 this.chkBusinessArray= new Ext.form.CheckboxGroup({
		width:180,
		fieldLabel: '已开展哪些业务<br/>（多选）',
		name : 'operatorsInfo.businessArray',
		items: [
		      {boxLabel: '财信通',inputValue:'1'},
		      {boxLabel: '银信通',inputValue:'2'},
		      {boxLabel: '商信通 ',inputValue:'3'}
		]
	});
	    
	//进入物业要求
	this.cmbEnterPropertyReq = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '移动进入物业要求',
        name : 'operatorsInfo.enterPropertyReq',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_ENTERPROPERTYREQ
        }),
        valueField: 'value',
        editable: false,
        displayField: 'name',
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    this.txtEnterPropertyDesc = new Ext.form.TextArea({
		fieldLabel : '要求描述 ',
		width : 400,
		height : 40,
		name : 'operatorsInfo.enterPropertyDesc',
		maxLength : 1000
	});
	
	//运营商进入该点的方式
	//电信
	this.cmbTelecomEnterMode = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '电信进入物业要求',
        name : 'operatorsInfo.telecomEnterMode',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_ENTERPROPERTYREQ
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //主推的业务名称
     this.txtTelecomMainBusinessName = new Ext.form.TextField({
		fieldLabel : '电信主推产品<font color="red">*</font> ',
		name : 'operatorsInfo.telecomMainBusinessName',
		width : 150,
		maxLength : 100
	});
	
	//主推的业务方案
	 this.txtTelecomMainBusinessDesc = new Ext.form.TextArea({
		fieldLabel : '主推的业务方案 ',
		name : 'operatorsInfo.telecomMainBusinessDesc',
		height : 40,
		width : 400,
		maxLength : 1000
	});
	
	//联通
	this.cmbUnioneEnterMode = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '联通进入物业要求',
        name: 'operatorsInfo.unioneEnterMode',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_ENTERPROPERTYREQ
        }),
        valueField: 'value',
        displayField: 'name',
        editable: false,
        typeAhead:true,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //主推的业务名称
     this.txtUnioneMainBusinessName = new Ext.form.TextField({
		fieldLabel : '联通主推产品<font color="red">*</font> ',
		name : 'operatorsInfo.unioneMainBusinessName',
		width : 150,
		maxLength : 100
	});
	
	//主推的业务方案
	 this.txtUnioneMainBusinessDesc = new Ext.form.TextArea({
		fieldLabel : '主推的业务方案 ',
		name : 'operatorsInfo.unioneMainBusinessDesc',
		height : 40,
		width : 400,
		maxLength : 1000
	});
	
	//代理商名称
	this.txtBusinessAgent = new Ext.form.Hidden({
		name :'businessAgent'
	});
	
	this.txtBusinessAgentInfoCustName = new Ext.form.TextField({
		fieldLabel : '代理商名称',
		name : 'businessAgentInfo.custName',
		width : 150,
		maxLength : 25
	});
	
	//代理商联系人 
	this.txtBaContactInfoContactId = new Ext.form.Hidden({
		name :'baContactInfo.contactId'
	});
	this.txtBaContactInfoUserName = new Ext.form.TextField({
		fieldLabel : '代理商联系人  ',
		name : 'baContactInfo.userName',
		width : 150
	});
	//代理商联系电话  	
	this.txtBaContactInfoPhoneNumOffice = new Ext.form.NumberField({
		fieldLabel : '代理商联系电话 ',
		name : 'baContactInfo.phoneNumOffice',
		width : 150,
		maxLength : 15
	});
	
	this.businessFromStore = new Ext.data.JsonStore({
	    url: '../gridbuildinginfo/listFromDimProductUsed.form?timesnap=' + Date.parse(new Date()),
	    root: 'result',
	    fields: ['PRODUCT_ID', 'PRODUCT_NAME'],
	    sortInfo: {
            field: 'PRODUCT_ID',
            direction: 'ASC'
        }
	});
    //是否开通专线
    this.isRay = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '是否开通专线<font color="red">*</font> ',
        name : 'isRay',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    //是否信号弱区
    this.isBadSignal = new Ext.form.ComboBox({
        width: 120,
        fieldLabel: '是否信号弱区<font color="red">*</font> ',
        name : 'operatorsInfo.isBadSignal',
        store: new Ext.data.SimpleStore({
        	fields: ['value', 'name'],
        	data: OMS.GRIDBUILDING_YESNO
        }),
        valueField: 'value',
        displayField: 'name',
        typeAhead:true,
        editable: false,
        mode: 'local',
        emptyText:'',
        triggerAction: 'all',
        selectOnFocus: true,
        forceSelection:true
    });
    
	//信号弱区描述
	this.badSignalDesc = new Ext.form.TextField({
		fieldLabel : '信号弱区描述<font color="red">*</font>  ',
		name : 'operatorsInfo.badSignalDesc',
		width : 150,
		maxLength : 100
	});
	//附件传输资源点  	
	this.nearlyResource = new Ext.form.TextField({
		fieldLabel : '附近传输资源点<font color="red">*</font> ',
		name : 'operatorsInfo.nearlyResource',
		width : 150,
		maxLength : 100
	});
	this.businessToStore=new Ext.data.JsonStore({
		url: '../gridbuildinginfo/listToDimProductUsed.form?timesnap=' + Date.parse(new Date()),
	    root: 'result',
	    fields: ['PRODUCT_ID', 'PRODUCT_NAME'],
	    sortInfo: {
            field: 'PRODUCT_ID',
            direction: 'ASC'
        }
	});
	
//	this.fsBusinessSelector = new Ext.form.FieldSet({
//		title:'已开展哪些业务（集团产品多选）',
//		items:[]
//	});
	
	//业务信息Business -- PanelForm
     this.businessForm = new Ext.form.FormPanel({
		bodyStyle : 'padding: 5px 5px 0',
		frame :true,
		autoScroll : true,
		height: 390,
		align:'center',
		width : 700,
		labelAlign: 'right',
		labelWidth : 130,
		layout : 'table',
		layoutConfig : {columns:2},
		items:[
		{colspan:1,layout:'form', items:[this.txtUnitManager]},
		{colspan:1,layout:'form', items:[this.txtUnitManagerPhone]},
		//{colspan:2,layout:'form', items:[this.chkMainOperatorList]},
		{colspan:2,layout:'form', items:[this.cmbTransferInplaceList]},
		{colspan:1,layout:'form', items:[this.cmbHasG]},
		{colspan:1,layout:'form', items:[this.cmbHasTd]},
		{colspan:1,layout:'form', items:[this.cmbHasWlan]},
		{colspan:1,layout:'form', items:[this.cmbHasBroadBand]},
		{colspan:1,layout:'form', items:[this.cmbIsDataNode]},
		{colspan:1,layout:'form', items:[this.cmbHasRecommend]},
		{colspan:1,layout:'form', items:[this.isRay]},
		{colspan:1,layout:'form', items:[this.isBadSignal]},
		{colspan:1,layout:'form', items:[this.badSignalDesc]},
		{colspan:1,layout:'form', items:[this.nearlyResource]},
		//{colspan:2,layout:'form', items:[this.cmbCustOpinion]},
	//	{colspan:2,layout:'form', items:[this.txtCustOpinionDesc]},
		//{colspan:2,layout:'form', items:[this.chkBusinessArray]},
		
		{colspan:2,bodyStyle:'padding: 5px 50px 10',items:[
			{
            xtype: 'itemselector',
            name: 'itemselector',
            hideLabel : false,
            fieldLabel: '移动主推产品',
            scope : this,
	        imagePath: '../resources/images/default/grid/',
            multiselects: [{
                width: 250,
                height: 200,
                store: this.businessFromStore,
                displayField: 'PRODUCT_NAME',
                valueField: 'PRODUCT_ID'
            },{
                width: 250,
                height: 200,
				store: this.businessToStore,
                displayField: 'PRODUCT_NAME',
                valueField: 'PRODUCT_ID'
            }]
        }
		]},
		{colspan:2,layout:'form', items:[this.cmbEnterPropertyReq]},
		{colspan:2,layout:'form', items:[this.txtEnterPropertyDesc]},
		{colspan:1,layout:'form', items:[this.cmbTelecomEnterMode]},
		{colspan:1,layout:'form', items:[this.txtTelecomMainBusinessName]},
		//{colspan:2,layout:'form', items:[this.txtTelecomMainBusinessDesc]},
		{colspan:1,layout:'form', items:[this.cmbUnioneEnterMode]},
		{colspan:1,layout:'form', items:[this.txtUnioneMainBusinessName]},
		//{colspan:2,layout:'form', items:[this.txtUnioneMainBusinessDesc]},
		{colspan:1,layout:'form', items:[this.txtBusinessAgentInfoCustName]},
		{colspan:1,layout:'form', items:[this.txtBaContactInfoUserName]},
		{colspan:1,layout:'form', items:[this.txtBaContactInfoPhoneNumOffice]},
		{colspan:1,layout:'form', items:[this.txtBaContactInfoContactId]},
		{colspan:1,layout:'form', items:[this.txtBusinessAgent]},
		{colspan:1,layout:'form', items:[this.txtOperators]},
		{colspan:1,layout:'form', items:[this.txtUnitManagerUserBranchId]}

		]
	});

	 this.tabs = new Ext.TabPanel({
        width:700,
        activeTab: 0,
        frame:true,
        //autoHeight:true,
        height : 420,
        deferredRender:false, 
		layoutOnTabChange:true,
		
        items:[
            {items:this.form, title: '基本信息'},
            {items:this.gisform, title: 'Gis信息'},
            {items:this.rentform,title:'租赁信息'},
            {items:this.contactInfoForm,title:'物业信息'},
            {items:this.businessForm,title:'业务信息'}
        ]
    });
    
	GridBuildingInfo.Detail.superclass.constructor.call(this,{
		title : '楼宇信息',
		bodyStyle: 'padding: 5px 5px 0',
        autoHeight: true,
        width: 730,
        resizable: false,
        plain: true,
        modal: true,
        autoScroll: true,
        closeAction: 'hide',
        //items: [[this.form],[this.gisform]],
        items :[this.tabs],
        buttons: [{
            text: '保存',
            cls: 'x-btn-text-icon btn-save',
            handler: this.onSave,
            scope: this
        }, {
            text: '关闭',
            cls: 'x-btn-text-icon btn-cancel',
            handler: this.hide.createDelegate(this, [])
        }]
		
	});
	this.connSave = new Ext.data.Connection({
		url: '../gridbuildinginfo/save.form?timesnap=' + Date.parse(new Date()),
		method: 'POST'
	});
};

Ext.extend(GridBuildingInfo.Detail,Ext.Window,{

	initData : function(id) {
			this.form.getForm().reset();
			this.gisform.getForm().reset();
			this.rentform.getForm().reset();
			this.contactInfoForm.getForm().reset();
			this.businessForm.getForm().reset();
			this.initFileUpload();
			var connection = new Ext.data.Connection({
						url : '../gridbuildinginfo/prepare.form?timesnap=' + Date.parse(new Date()),
						method : 'POST'
					});
			if(id!=null){
				Utils.request(connection, {
						params : {
							buildingId : id
						},
						scope : this,
						success : function(resp, action) {
							var obj = resp.gridBuildingInfo;
							//console.info(obj);
							
							//营销单元
							this.scope.txtUnitId.setValue(obj.unitId);
							this.scope.cmbRegion.setValue(obj.areaId);
							this.scope.cmbGridId.setValue(obj.gridId);
							this.scope.txtBuildingId.setValue(obj.buildingId);
							this.scope.txtBuildingName.setValue(obj.buildingName);
							//楼宇简介
							this.scope.txtBuildingDesc.setValue(obj.buildingDesc);
							//地址ID
							this.scope.txtAddressId.setValue(obj.addressId);
							//行政区县
							this.scope.txtDistrict.setValue(obj.addressInfo.district);
							//街道路段
							this.scope.txtAddressInfoNeighbourhood.setValue(obj.addressInfo.neighbourhood);				
							//地址-路
							this.scope.txtAddressInfoStreet.setValue(obj.addressInfo.street);
							//弄
							this.scope.txtAddressInfoAlley.setValue(obj.addressInfo.alley);
							//号
							this.scope.txtAddressInfoDoorNum.setValue(obj.addressInfo.doorNum);
							//楼宇类别
							this.scope.cmbBuildingType.setValue(obj.buildingType);
							//楼宇档次
							this.scope.cmbBuildingGrade.setValue(obj.buildingGrade);
							//楼宇整体外观
							this.scope.cmbBuildingAppearance.setValue(obj.buildingAppearance);
							//附近商圈
							this.scope.cmbBuildingBusinessArea.setValue(obj.businessArea);
							//楼宇开发商名称
							this.scope.txtDevelopCompany.setValue(obj.developCompany);
							//楼宇注册资金
							this.scope.txtRegisteredCapital.setValue(obj.registeredCapital);
							//开发商联系人
							this.scope.txtDevelopContactName.setValue(obj.dcContactInfo.userName);
							//开发商联系电话
							this.scope.txtDevelopContactPhone.setValue(obj.dcContactInfo.phoneNumOffice);
							//楼宇建设进展
							this.scope.cmbBuildingConstructionsStatus.setValue(obj.constructionStatus);	
							//竣工日期
							this.scope.dfBuildingFinishDate.setValue(obj.constructionFinishDateStr);	
							//生效日期
							this.scope.dfDisableDate.setValue(obj.disableDateStr);
							//失效日期
							this.scope.dfEnableDate.setValue(obj.enableDateStr);					
							//保密
							this.scope.cmbSecrecyLevel.setValue(obj.secrecyLevel);
							//状态
							this.scope.cmbUnitStatus.setValue(obj.unitStatus);
							//承包方
							this.scope.builderName.setValue(obj.builderName);
							//楼栋数
							this.scope.buildingNum.setValue(obj.buildingNum);
							//门洞数
							this.scope.doorNum.setValue(obj.doorNum);
							//最近的营业厅
							this.scope.nearlyHallName.setValue(obj.nearlyHallName);
							//楼宇图片	
			    			for(i=0;i<obj.buildPicList.length;i++){
			    				var picItem = obj.buildPicList[i];
			    				var picDiv = '<div class="MultiFile-label" id="pic'+picItem.attaId+'"><a href="javascript:;" onclick="deleteBuildingPic('
			    					+ picItem.attaId+',\''+picItem.attaName+'\')">删除</a> <a href="../upload/building/'+picItem.fileName+'" target="_blank">'+
			    					picItem.attaName+'</a> </div>';
			    				$('#fileUpload_wrap_list').append(picDiv);
			    			}
							//Gis信息			    			
							//楼宇经度
							this.scope.txtAddressInfoLongitude.setValue(obj.addressInfo.longitude);
							//楼宇纬度
							this.scope.txtAddressInfoLatitude.setValue(obj.addressInfo.latitude);
							//图标ID
							if(obj.gisInfo != null){
								this.scope.txtGisId.setValue(obj.gisInfo.id);
								this.scope.txtGisIconId.setValue(obj.gisInfo.iconId);
								var namePos = obj.gisInfo.namePos;
								if(namePos!=null && namePos!=""){
									var vv = namePos.split(",");
									if(vv.length==2){
										//楼宇经度
										this.scope.txtAddressInfoLongitude.setValue(vv[0]);
										//楼宇纬度
										this.scope.txtAddressInfoLatitude.setValue(vv[1]);
									}
								}
										
								var ecoordinfo = obj.gisInfo.rectScale;
								if(ecoordinfo!=null && ecoordinfo!=""){
									var vv = ecoordinfo.split(",");
									if(vv.length>1){
										this.scope.txtEcoordx.setValue(vv[0]);
										this.scope.txtEcoordy.setValue(vv[1]);
									}
								}
							}			
							//GisId
							this.scope.txtGisId.setValue(obj.gisId);
							////租赁信息
							//楼宇开始招租日期
							this.scope.dfRentStartDate.setValue(obj.rentStartDateStr);
							//楼宇面积
							this.scope.txtTotalArea.setValue(obj.totalArea);
							//楼宇层数
							this.scope.txtTotalFloors.setValue(obj.totalFloors);
							//楼宇总商户数
							this.scope.TotalMerchantNum.setValue(obj.totalMerchantNum);
							//已入驻商户数
							this.scope.txtCheckinMerchantNum.setValue(obj.checkinMerchantNum);
							//楼宇入住率
							this.scope.txtOccupancyRate.setValue(obj.occupancyRate);
							//楼宇租金
							this.scope.txtRentCharge.setValue(obj.rentCharge);
							//楼宇车位 
							this.scope.txtGarageNum.setValue(obj.garageNum);
							//楼宇中商户行业特征
							//排名第一行业
							this.scope.cmbFirstIndustry.setValue(obj.firstIndustry);
							//占比
							this.scope.txtFirstIndustryPer.setValue(obj.firstIndustryPer);
							//排名第二行业
							this.scope.cmbSecondIndustry.setValue(obj.secondIndustry);
							//占比
							this.scope.txtSecondIndustryPer.setValue(obj.secondIndustryPer);
							//排名第三行业
							this.scope.cmbThirdIndustry.setValue(obj.thirdIndustry);
							//占比
							this.scope.txtThirdIndustryPer.setValue(obj.thirdIndustryPer);
							//楼宇招商方向
							this.scope.txtAttractInvestment.setValue(obj.attractInvestment);
							
							////物业信息
							//楼宇物业公司名称
							this.scope.txtCompanyInfoCustName.setValue(obj.propertyCompanyInfo.custName);
							this.scope.txtPropertyCompany.setValue(obj.propertyCompany);
							//物业公司经理
							this.scope.txtPmContactInfoContactId.setValue(obj.pmContactInfo.contactId);
							this.scope.txtPmContactInfoUserName.setValue(obj.pmContactInfo.userName);
							this.scope.txtPmContactInfoPosition.setValue(obj.pmContactInfo.position);
							//联系电话
							this.scope.txtPmContactInfoPhoneNumOffice.setValue(obj.pmContactInfo.phoneNumOffice);
							this.scope.txtPmContactInfoMobileNumber.setValue(obj.pmContactInfo.mobileNumber);
							//物业公司招商部经理
							this.scope.txtPbContactInfoContactId.setValue(obj.pbContactInfo.contactId);
							this.scope.txtPbContactInfoPosition.setValue(obj.pbContactInfo.position);
							this.scope.txtPbContactInfoUserName.setValue(obj.pbContactInfo.userName);
							//联系电话
							this.scope.txtPbContactInfoPhoneNumOffice.setValue(obj.pbContactInfo.phoneNumOffice);
							this.scope.txtPbContactInfoMobileNumber.setValue(obj.pbContactInfo.mobileNumber);
							
							//物业公司招商部经理
							this.scope.txtPpContactInfoContactId.setValue(obj.ppContactInfo.contactId);
							this.scope.txtPpContactInfoPosition.setValue(obj.ppContactInfo.position);
							this.scope.txtPpContactInfoUserName.setValue(obj.ppContactInfo.userName);
							//联系电话
							this.scope.txtPpContactInfoPhoneNumOffice.setValue(obj.ppContactInfo.phoneNumOffice);
							this.scope.txtPpContactInfoMobileNumber.setValue(obj.ppContactInfo.mobileNumber);
							////业务信息
							//客户经理
							//this.scope.txtUserBranchId.setValue(obj.User.branchId);
							if(obj.unitManagerUser != null){
								this.scope.selectUserId = obj.unitManager;
								this.scope.txtUnitManager.setValue(obj.unitManagerUser.userName);
								//联系方式
								this.scope.txtUnitManagerPhone.setValue(obj.unitManagerUser.phone);
							}else{
								this.scope.selectUserId = '';
								this.scope.txtUnitManager.setValue('');
								//联系方式
								this.scope.txtUnitManagerPhone.setValue('');
							}
							//楼内主要运营商
							this.scope.txtOperators.setValue(obj.operators);
							this.scope.chkMainOperatorList.setValueForItem(obj.operatorsInfo.mainOperators);
							//传输到位情况
							this.scope.cmbTransferInplaceList.setValue(obj.operatorsInfo.transferInplace);
							//G已建
							this.scope.cmbHasG.setValue(obj.operatorsInfo.hasG);
							//TD已建
							this.scope.cmbHasTd.setValue(obj.operatorsInfo.hasTd);
							//WLAN已建
							this.scope.cmbHasWlan.setValue(obj.operatorsInfo.hasWlan);
							//移动宽带接入
							this.scope.cmbHasBroadBand.setValue(obj.operatorsInfo.hasBroadBand);
							//是否数据节点
							this.scope.cmbIsDataNode.setValue(obj.operatorsInfo.isDataNode);
							//是否推荐过业务
							this.scope.cmbHasRecommend.setValue(obj.operatorsInfo.hasRecommend);
							//客户对运营商的评价
							this.scope.cmbCustOpinion.setValue(obj.operatorsInfo.custOpinion);
							this.scope.txtCustOpinionDesc.setValue(obj.operatorsInfo.custOpinionDesc);
							//已开展哪些业务
							this.scope.businessFromStore.load({params:{'operatorsDesc':obj.operatorsInfo.businessDesc}});
							this.scope.businessToStore.load({params:{'operatorsDesc':obj.operatorsInfo.businessDesc}});
							//进入物业要求
							this.scope.cmbEnterPropertyReq.setValue(obj.operatorsInfo.enterPropertyReq);
							this.scope.txtEnterPropertyDesc.setValue(obj.operatorsInfo.enterPropertyDesc);
							//电信
							this.scope.cmbTelecomEnterMode.setValue(obj.operatorsInfo.telecomEnterMode);
							//主推的业务名称
							this.scope.txtTelecomMainBusinessName.setValue(obj.operatorsInfo.telecomMainBusinessName);
							//主推的业务方案
							this.scope.txtTelecomMainBusinessDesc.setValue(obj.operatorsInfo.telecomMainBusinessDesc);
							//联通
							this.scope.cmbUnioneEnterMode.setValue(obj.operatorsInfo.unioneEnterMode);
							//主推的业务名称
							this.scope.txtUnioneMainBusinessName.setValue(obj.operatorsInfo.unioneMainBusinessName);
							//主推的业务方案
							this.scope.txtUnioneMainBusinessDesc.setValue(obj.operatorsInfo.unioneMainBusinessDesc);
							
							this.scope.isBadSignal.setValue(obj.operatorsInfo.isBadSignal),
							this.scope.isRay.setValue(obj.operatorsInfo.isRay),
							this.scope.badSignalDesc.setValue(obj.operatorsInfo.badSignalDesc),
							this.scope.nearlyResource.setValue(obj.operatorsInfo.nearlyResource),							
							
							
							//代理商名称
							this.scope.txtBusinessAgent.setValue(obj.businessAgent);
							this.scope.txtBusinessAgentInfoCustName.setValue(obj.businessAgentInfo.custName);
							//代理商联系人 
							this.scope.txtBaContactInfoContactId.setValue(obj.baContactInfo.contactId);
							this.scope.txtBaContactInfoUserName.setValue(obj.baContactInfo.userName);			
							//代理商联系电话 
							this.scope.txtBaContactInfoPhoneNumOffice.setValue(obj.baContactInfo.phoneNumOffice);
						},
						after : function() {
							
						}
					});
			}else{
				this.businessFromStore.load();
			}
		},
		initFileUpload:function(){
			$('#fileUpload').val('').attr('style','').nextAll('.MultiFile').remove();	
		    $('#fileUpload_wrap_list').html('');
			$('#fileUpload').MultiFile({   
		       accept:'gif|jpg|png|jpeg|bmp', max:10, STRING: {   
		       remove:'删除',   
		       selected:'已选中：$file',   
		       denied:'不支持上传该文件类型 $ext!',
		       duplicate:'此文件已经被选择：$file'
		      }   
		    });  						
		},
		showSelector: function(event) {
			if (!this.userSelector) {
				this.userSelector = new Selector.User(this, '客户经理');
			}
			//console.info(this.users);
			this.userSelector.initUsers(this.users);
			this.userSelector.show();
		},
		
		setUsers: function(o) {	// for Selector.User callback
			if(o.length>0){
				this.users = o;
				this.txtUnitManager.setValue(this.users[0].name);
				this.selectUserId = this.users[0].id;
			}
		},
		
		onSave: function(btn, event) {
			var basicForm =this.form.getForm();
			if (!basicForm.isValid()) {
				return;
			}
			//btn.disabled = true; 
//			basicForm.fileUpload = true;
			basicForm.doAction('submit', { 
				method : 'post',
				url : '../gridbuildinginfo/save.form', 
//			Utils.request(this.connSave, {
				params: {
					//'buildingId' :this.txtBuildingId.getValue(),
//					'buildingName' :this.txtBuildingName.getValue(),
//					'buildingDesc' :this.txtBuildingDesc.getValue(),
//					'addressInfo.neighbourhood' :this.txtAddressInfoNeighbourhood.getValue(),
//					'addressInfo.street' :this.txtAddressInfoStreet.getValue(),
//					'addressInfo.alley' :this.txtAddressInfoAlley.getValue(),
//					'addressInfo.doorNum' :this.txtAddressInfoDoorNum.getValue(),
					'buildingType' :this.cmbBuildingType.getValue(),
					'buildingGrade' :this.cmbBuildingGrade.getValue(),
					'buildingAppearance' :this.cmbBuildingAppearance.getValue(),
					'businessArea' :this.cmbBuildingBusinessArea.getValue(),
//					'developCompany' :this.txtDevelopCompany.getValue(),
//					'registeredCapital' :this.txtRegisteredCapital.getValue(),
//					'dcContactInfo.userName' :this.txtDevelopContactName.getValue(),
//					'dcContactInfo.phoneNumOffice' :this.txtDevelopContactPhone.getValue(),
					'constructionStatus' :this.cmbBuildingConstructionsStatus.getValue(),
					'secrecyLevel' :this.cmbSecrecyLevel.getValue(),
					'unitStatus' :this.cmbUnitStatus.getValue(),
					'areaId' :this.cmbRegion.getValue(),
					'gridId' :this.cmbGridId.getValue(),
					'addressInfo.longitude' :this.txtAddressInfoLongitude.getValue(),
					'addressInfo.latitude' :this.txtAddressInfoLatitude.getValue(),
					'gisId' :this.txtGisId.getValue(),
					'gisInfo.iconId' :this.txtGisIconId.getValue(),
					'gisInfo.ecoordx' :this.txtEcoordx.getValue(),
					'gisInfo.ecoordy' :this.txtEcoordy.getValue(),
					'rentStartDate' :this.dfRentStartDate.getValue()==''?'':this.dfRentStartDate.getValue().format('Y-m-d'),
					'totalArea' :this.txtTotalArea.getValue(),
					'totalFloors' :this.txtTotalFloors.getValue(),
					'totalMerchantNum' :this.TotalMerchantNum.getValue(),
					'checkinMerchantNum' :this.txtCheckinMerchantNum.getValue(),
					'occupancyRate' :this.txtOccupancyRate.getValue(),
					'rentCharge' :this.txtRentCharge.getValue(),
					'garageNum' :this.txtGarageNum.getValue(),
					'firstIndustry' :this.cmbFirstIndustry.getValue(),
					'firstIndustryPer' :this.txtFirstIndustryPer.getValue(),
					'secondIndustry' :this.cmbSecondIndustry.getValue(),
					'secondIndustryPer' :this.txtSecondIndustryPer.getValue(),
					'thirdIndustry' :this.cmbThirdIndustry.getValue(),
					'thirdIndustryPer' :this.txtThirdIndustryPer.getValue(),
					'attractInvestment' :this.txtAttractInvestment.getValue(),
					'propertyCompanyInfo.custName' :this.txtCompanyInfoCustName.getValue(),
					'propertyCompany' :this.txtPropertyCompany.getValue(),
					'pmContactInfo.contactId' :this.txtPmContactInfoContactId.getValue(),
					'pmContactInfo.userName' :this.txtPmContactInfoUserName.getValue(),
					'pmContactInfo.position' :this.txtPmContactInfoPosition.getValue(),
					'pmContactInfo.phoneNumOffice' :this.txtPmContactInfoPhoneNumOffice.getValue(),
					'pmContactInfo.mobileNumber' :this.txtPmContactInfoMobileNumber.getValue(),
					'pbContactInfo.contactId' :this.txtPbContactInfoContactId.getValue(),
					'pbContactInfo.userName' :this.txtPbContactInfoUserName.getValue(),
					'pbContactInfo.position' :this.txtPbContactInfoPosition.getValue(),
					'pbContactInfo.phoneNumOffice' :this.txtPbContactInfoPhoneNumOffice.getValue(),
					'pbContactInfo.mobileNumber' :this.txtPbContactInfoMobileNumber.getValue(),
					'ppContactInfo.contactId' :this.txtPpContactInfoContactId.getValue(),
					'ppContactInfo.position' :this.txtPpContactInfoPosition.getValue(),
					'ppContactInfo.userName' :this.txtPpContactInfoUserName.getValue(),
					'ppContactInfo.phoneNumOffice' :this.txtPpContactInfoPhoneNumOffice.getValue(),
					'ppContactInfo.mobileNumber' :this.txtPpContactInfoMobileNumber.getValue(),
					'unitManager' :this.selectUserId,
					//'unitManager.phone' :this.txtUnitManagerPhone.getValue(),
					'operators' :this.txtOperators.getValue(),
					//'operatorsInfo.mainOperators' :getCheckBoxGroupValue(this.chkMainOperatorList),
					'operatorsInfo.transferInplace' :this.cmbTransferInplaceList.getValue(),
					'operatorsInfo.hasG' :this.cmbHasG.getValue(),
					'operatorsInfo.hasTd' :this.cmbHasTd.getValue(),
					'operatorsInfo.hasWlan' :this.cmbHasWlan.getValue(),
					'operatorsInfo.hasBroadBand' :this.cmbHasBroadBand.getValue(),
					'operatorsInfo.isDataNode' :this.cmbIsDataNode.getValue(),
					'operatorsInfo.hasRecommend' :this.cmbHasRecommend.getValue(),
					'operatorsInfo.custOpinion' :this.cmbCustOpinion.getValue(),
					'operatorsInfo.custOpinionDesc' :this.txtCustOpinionDesc.getValue(),
					'operatorsInfo.businessDesc' :getItemSelectorValue(this.businessToStore),
					'operatorsInfo.enterPropertyReq' :this.cmbEnterPropertyReq.getValue(),
					'operatorsInfo.enterPropertyDesc' :this.txtEnterPropertyDesc.getValue(),
					'operatorsInfo.telecomEnterMode' :this.cmbTelecomEnterMode.getValue(),
					'operatorsInfo.telecomMainBusinessName' :this.txtTelecomMainBusinessName.getValue(),
					'operatorsInfo.telecomMainBusinessDesc' :this.txtTelecomMainBusinessDesc.getValue(),
					'operatorsInfo.unioneEnterMode' :this.cmbUnioneEnterMode.getValue(),
					'operatorsInfo.unioneMainBusinessName' :this.txtUnioneMainBusinessName.getValue(),
					'operatorsInfo.unioneMainBusinessDesc' :this.txtUnioneMainBusinessDesc.getValue(),
					
					'operatorsInfo.isBadSignal' :this.isBadSignal.getValue(),
					'operatorsInfo.isRay' :this.isRay.getValue(),
					'operatorsInfo.badSignalDesc' :this.badSignalDesc.getValue(),
					'operatorsInfo.nearlyResource' :this.nearlyResource.getValue(),
					
					'businessAgent' :this.txtBusinessAgent.getValue(),
					'businessAgentInfo.custName' :this.txtBusinessAgentInfoCustName.getValue(),
					'baContactInfo.contactId' :this.txtBaContactInfoContactId.getValue(),
					'baContactInfo.userName' :this.txtBaContactInfoUserName.getValue(),
					'baContactInfo.phoneNumOffice' :this.txtBaContactInfoPhoneNumOffice.getValue()
					
				},
				scope: this,
				success: function(form, action) {
//					console.info(this);
					this.parentList.update();
					this.hide();
				},
				failure:function(){
					Utils.info('操作失败!','系统提示');
					return;
				},
				after: function() {}
			});
	},
		
		//add by JimmyLee start
		initGis:function(name, iconId, coordx, coordy, ecoordx, ecoordy, gridId){
			this.txtAddressInfoLongitude.setValue(coordx);
			this.txtAddressInfoLatitude.setValue(coordy);
			this.txtGisIconId.setValue(iconId);
			this.txtEcoordx.setValue(ecoordx);
			this.txtEcoordy.setValue(ecoordy);
			//this.cmbGridId.setValue(gridId);
		},
		viewGis:function(){
			var unitId = this.txtUnitId.getValue();
			var areaId = this.cmbRegion.getValue();
			var layerType;
			if(unitId==null||unitId==""){
				layerType = 1;
				if(areaId==''){
					Utils.warn('请先选择区域！');
					return;
				}
			}else{
				layerType = 2;
			}
			var str = OMS.GIS_IP+'/gis_for_management.jsp?areaId=' + areaId + '&did=' + unitId  + '&iconId=' + this.txtGisIconId.getValue()
				+ '&coordx='   +this.txtAddressInfoLongitude.getValue()+ '&coordy='+this.txtAddressInfoLatitude.getValue() 
				+ '&name=' + this.txtBuildingName.getValue()+ '&ecoordx=' + this.txtEcoordx.getValue()+'&ecoordy=' + this.txtEcoordy.getValue()+ '&layerType='+layerType;
			window.open(encodeURI(str), '_blank', 'toolbar=no,location=no,directories=no,scrollbars=no,menubar=no,width=1000,height=600,resizable=no,left=0,top=0, status=no');	
		}
});

function initGisData(name, iconId, coordx, coordy, ecoordx, ecoordy, gridId){
	lister.detailPanel.initGis(name, iconId, coordx, coordy, ecoordx, ecoordy, gridId);
};
//add by JimmyLee end

function getCheckBoxGroupValue(checkGroup){
	var value = '';
	//console.info(checkGroup);
	var checkedBoxArray = checkGroup.items.items;
	if(checkedBoxArray.length>0){
		for(i=0;i<checkedBoxArray.length;i++){
			if(checkedBoxArray[i].checked){
				if(value!=''){
					value += ',';
				}
				value += checkedBoxArray[i].inputValue;
			}
		}
	}
	return value;
};

function getItemSelectorValue(store){
	var value = '';
	for(var i=0;i<store.getCount()-1;i++){
		value+=	store.getAt(i).get('PRODUCT_ID')+',';	
	}
	if(store.getCount()>0){
		value +=store.getAt(store.getCount()-1).get('PRODUCT_ID');
	}
	return value;
};

function deleteBuildingPic(attaId,picName) {
	Ext.MessageBox.confirm("提示","确认删除楼宇图片  '"+picName+"' ？",function(btn){
	    if(btn=="yes"){
	        //alert("yes");
	        Utils.request(new Ext.data.Connection({
					url: '../gridbuildinginfo/deletePic.form?timesnap=' + Date.parse(new Date()),
					method: 'POST'
				}), {
				params: {
					'attaId': attaId
				},
				success: function(resp, action) {
					$("#pic"+attaId).remove();
				}
			});
	    }
	});	
}

